package entity;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.geom.Vector2f;

public class LivingEntity extends Entity{


	float damage;
	float maxLife;
	
	float actLife;
	
	int regenerationSpeed;
	int regenerationTime = 0;
		
	public LivingEntity(Vector2f position)
	{
		super(position);
	}
	public void render(GameContainer container, Graphics g) throws SlickException
	{	

	}
	public void update(GameContainer container, int delta) throws SlickException
	{		
	}
	public void takeDamage(float d)
	{
		actLife -= d;
	}
	public boolean isDead()
	{
		if(actLife <= 0)
			return true;
		return false;
	}
	public void lifeRegeneration()
	{
		regenerationTime++;
		if(regenerationTime > 300 - regenerationSpeed * 25)
		{
			if(actLife < maxLife)
				actLife++;
			regenerationTime = 0;
		}
	}
	public float getLife() //return percent of life
	{
		return actLife/maxLife * 100;
	}
	public void addRegeneration()
	{
		if(regenerationSpeed < 10)
			regenerationSpeed++;
	}
	public float getDamage() {
		return damage;
	}
	public float getMaxLife() {
		return maxLife;
	}
	public float getActLife()
	{
		return actLife;
	}
	public int getRegenerationSpeed() {
		return regenerationSpeed;
	}
	

}
